package pt.iscte.pcd.project.remote;

import java.io.Serializable;

import pt.iscte.pcd.project.interfaces.EntryType;
import pt.iscte.pcd.project.interfaces.PCDDirectory;
import pt.iscte.pcd.project.interfaces.PCDEntry;

public abstract class RemoteEntry implements PCDEntry, Serializable {

	private static final long serialVersionUID = 1L;

	private String fullPath;
	private String fileName;

	private EntryType type;

	private PCDDirectory parent;
	
	
	@Override
	public String toString() {
		return getName();
	}
	public RemoteEntry(String fullPath, String nameEntry, EntryType type, PCDDirectory parent) {
		this.type = type;
		this.parent = parent;
		this.fullPath = fullPath;
		this.fileName = nameEntry;
	}
		
	public String getFullPath() {
		return fullPath;
	}
	
	@Override
	public PCDDirectory getParent() {
		return parent;
	}

	@Override
	public String getName() {
		return getFileName();
	}

	@Override
	public boolean readLock() {
		return true;
	}

	@Override
	public boolean writeLock() {
		return true;
	}

	@Override
	public void readUnlock() {}

	@Override
	public void writeUnlock(){};

	@Override
	public boolean exists() {
		return true;
	}

	@Override
	public EntryType getType() {
		return type;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
}